package com.pjnkj.thunder.timer;

import com.pjnkj.thunder.dagger.common.SpringUtils;
import com.pjnkj.thunder.mapper.SqlMapper;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component // 把此类托管给 Spring，不能省略
public class TaskUtils {
    // 添加定时任务
    @Scheduled(cron = "0 0 0 * * ?") // cron 表达式，每周五 23:59:59 执行
    public void doTask() {
        SqlMapper sqlMapper = SpringUtils.getBean("sqlMapper");
        sqlMapper.setFieldAll("0", "onceday", "user");
    }
}